package com.yy.bolg.controller.electrician;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.yy.bolg.constant.ResultCode;
import com.yy.bolg.entity.ElectricianBean;
import com.yy.bolg.entity.EvaluateBean;
import com.yy.bolg.entity.WorkOrderBean;
import com.yy.bolg.request.ElectricianRequest;
import com.yy.bolg.resp.ElectricianResp;
import com.yy.bolg.resp.statistics.electrician.ElectricianEvaluateStatisticsResp;
import com.yy.bolg.resp.statistics.electrician.ElectricianWorkOrderStatisticsResp;
import com.yy.bolg.service.ElectricianService;
import com.yy.bolg.service.EvaluateService;
import com.yy.bolg.service.WorkOrderService;
import com.yy.bolg.util.CodeGenerateUtil;
import com.yy.bolg.util.DateUtil;
import com.yy.bolg.util.RespenseJsonTransformationUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 电工控制器
 * @author enmaoFu
 * @date 2024-11-01
 * RequestMapping("/electrician") 是说明这个类的访问地址是 /electrician
 */
@Api(tags = {"电工"})
@Controller
@RequestMapping(value = "/electrician")
public class ElectricianController {

    @Autowired
    private ElectricianService service;// 自动载入Service对象

    @Autowired
    private WorkOrderService workOrderService;// 自动载入Service对象

    @Autowired
    private EvaluateService evaluateService;// 自动载入Service对象

    /**
     * 登录
     * 服务器访问路径：http://localhost:8080/bolg/electrician/signIn
     * 本地访问路径：http://localhost:8111/electrician/signIn
     * 参数：
     * {"electricianPhone":"15123000000","electricianPwd":"123456"}
     */
    @ApiOperation(value = "登录", notes = "参数：{\"electricianPhone\":\"15123000000\",\"electricianPwd\":\"123456\"}")
    @RequestMapping(value = "/signIn",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String signIn(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());
        electricianBean.setPsElectricianPwd(request.getElectricianPwd());
        electricianBean.setPsElectricianLoginState(1);

        try {
            String code = service.signIn(electricianBean);

            Map map = new HashMap();
            map.put("data", code);

            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "登录成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 退出
     * 服务器访问路径：http://localhost:8080/bolg/electrician/signOut
     * 本地访问路径：http://localhost:8111/electrician/signOut
     * 参数：
     * {"electricianPhone":"15123000000"}
     */
    @ApiOperation(value = "退出", notes = "参数：{\"electricianPhone\":\"15123000000\"}")
    @RequestMapping(value = "/signOut",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String signOut(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());
        electricianBean.setPsElectricianLoginState(2);

        try {
            service.signOut(electricianBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "退出成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 注册
     * 服务器访问路径：http://localhost:8080/bolg/electrician/register
     * 本地访问路径：http://localhost:8111/electrician/register
     * 参数：
     * {"electricianHead":"","electricianName":"刘德华","electricianPhone":"15123390980","electricianPwd":"123456","electricianNvqImg":"sss","electricianIdFrontImg":"","electricianIdBackImg":"","electricianIdCode":"","electricianProvince":"重庆","electricianCity":"重庆","electricianRegion":"渝北区","electricianAddress":"黄山大道10号","electricianLongitude":"23.123123","electricianLatitude":"102.32343"}
     */
    @ApiOperation(value = "注册", notes = "参数：{\"electricianHead\":\"\",\"electricianName\":\"刘德华\",\"electricianPhone\":\"15123390980\",\"electricianPwd\":\"123456\",\"electricianNvqImg\":\"sss\",\"electricianIdFrontImg\":\"\",\"electricianIdBackImg\":\"\",\"electricianIdCode\":\"\",\"electricianProvince\":\"重庆\",\"electricianCity\":\"重庆\",\"electricianRegion\":\"渝北区\",\"electricianAddress\":\"黄山大道10号\",\"electricianLongitude\":\"23.123123\",\"electricianLatitude\":\"102.32343\"}")
    @RequestMapping(value = "/register",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String register(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianCode(CodeGenerateUtil.getElectricianCode());
        if(StringUtils.isEmpty(request.getElectricianHead())){
            electricianBean.setPsElectricianHead("https://www.cqwuyang.cn/images/defaultHead.png");
        }else{
            electricianBean.setPsElectricianHead(request.getElectricianHead());
        }
        electricianBean.setPsElectricianName(request.getElectricianName());
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());
        electricianBean.setPsElectricianPwd(request.getElectricianPwd());
        electricianBean.setPsElectricianIdFrontImg(request.getElectricianIdFrontImg());
        electricianBean.setPsElectricianIdBackImg(request.getElectricianIdBackImg());
        electricianBean.setPsElectricianIdCode(request.getElectricianIdCode());
        electricianBean.setPsElectricianNvqImg(request.getElectricianNvqImg());
        electricianBean.setPsElectricianProvince(request.getElectricianProvince());
        electricianBean.setPsElectricianCity(request.getElectricianCity());
        electricianBean.setPsElectricianRegion(request.getElectricianRegion());
        electricianBean.setPsElectricianAddress(request.getElectricianAddress());
        electricianBean.setPsElectricianLongitude(request.getElectricianLongitude());
        electricianBean.setPsElectricianLatitude(request.getElectricianLatitude());
        electricianBean.setPsElectricianLoginState(1);
        electricianBean.setPsElectricianState(2);
        electricianBean.setPsElectricianStateRemarks("");

        try {
            service.add(electricianBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "注册成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 删除电工
     * 服务器访问路径：http://localhost:8080/bolg/electrician/delete
     * 本地访问路径：http://localhost:8111/electrician/delete
     * 参数：
     * {"electricianPhone":"15123000000"}
     */
    @ApiOperation(value = "删除电工", notes = "参数：{\"electricianPhone\":\"15123000000\"}")
    @RequestMapping(value = "/delete",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String delete(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());

        try {
            service.del(electricianBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "删除成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 电工状态更改
     * 服务器访问路径：http://localhost:8080/bolg/electrician/stateUp
     * 本地访问路径：http://localhost:8111/electrician/stateUp
     * 参数：
     * {"electricianPhone":"15123000000","electricianState": 1,"electricianStateRemarks":"备注"}
     */
    @ApiOperation(value = "电工状态更改", notes = "参数：{\"electricianPhone\":\"15123000000\",\"electricianState\": 1,\"electricianStateRemarks\":\"备注\"}")
    @RequestMapping(value = "/stateUp",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String stateUp(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());
        electricianBean.setPsElectricianState(request.getElectricianState());
        electricianBean.setPsElectricianStateRemarks(request.getElectricianStateRemarks());

        try {
            service.upState(electricianBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "操作成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取电工信息
     * 服务器访问路径：http://localhost:8080/bolg/electrician/getElectricianInfo
     * 本地访问路径：http://localhost:8111/electrician/getElectricianInfo
     * 参数：
     * {"electricianPhone":"15123000000"}
     */
    @ApiOperation(value = "获取电工信息", notes = "参数：{\"electricianPhone\":\"15123000000\"}", response = ElectricianResp.class)
    @RequestMapping(value = "/getElectricianInfo",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getElectricianInfo(@RequestBody ElectricianRequest request){
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianPhone(request.getElectricianPhone());

        try {
            ElectricianBean returnBean = service.findOneByPhone(electricianBean);
            if (null != returnBean) {
                ElectricianResp resp = new ElectricianResp();
                resp.setElectricianCode(returnBean.getPsElectricianCode());
                resp.setElectricianHead(returnBean.getPsElectricianHead());
                resp.setElectricianName(returnBean.getPsElectricianName());
                resp.setElectricianPhone(returnBean.getPsElectricianPhone());
                resp.setElectricianPwd(returnBean.getPsElectricianPwd());
                resp.setElectricianIdFrontImg(returnBean.getPsElectricianIdFrontImg());
                resp.setElectricianIdBackImg(returnBean.getPsElectricianIdBackImg());
                resp.setElectricianIdCode(returnBean.getPsElectricianIdCode());
                resp.setElectricianNvqImg(returnBean.getPsElectricianNvqImg());
                resp.setElectricianProvince(returnBean.getPsElectricianProvince());
                resp.setElectricianCity(returnBean.getPsElectricianCity());
                resp.setElectricianRegion(returnBean.getPsElectricianRegion());
                resp.setElectricianAddress(returnBean.getPsElectricianAddress());
                resp.setElectricianLatitude(returnBean.getPsElectricianLatitude());
                resp.setElectricianLoginState(returnBean.getPsElectricianLoginState());
                resp.setElectricianState(returnBean.getPsElectricianState());
                resp.setElectricianStateRemarks(returnBean.getPsElectricianStateRemarks());

                Map map = new HashMap();
                map.put("data", resp);
                result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "获取信息成功", map);
            } else {
                result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL,"暂无数据",new HashMap());
            }
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL,e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询（分页）电工-支持区域、姓名、认证状态条件查询-条件字段可空（分页相关除外）
     * 服务器访问路径：http://localhost:8080/bolg/electrician/findAllByCondition
     * 本地访问路径：http://localhost:8111/electrician/findAllByCondition
     * 参数：
     * {"electricianRegion":"渝北区","electricianName":"刘","electricianState":-1,"pageNum":"1","pageSize":"5"}
     */
    @ApiOperation(value = "询（分页）电工-支持区域、姓名、认证状态条件查询-条件字段可空（分页相关除外）", notes = "参数：{\"electricianRegion\":\"渝北区\",\"electricianName\":\"刘\",\"electricianState\":-1,\"pageNum\":\"1\",\"pageSize\":\"5\"}", response = ElectricianResp.class)
    @RequestMapping(value = "/findAllByCondition",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findAllByCondition(@RequestBody ElectricianRequest request){
        Page pageInfo = PageHelper.startPage(request.getPageNum(), request.getPageSize());
        String result;

        ElectricianBean electricianBean = new ElectricianBean();
        electricianBean.setPsElectricianRegion(request.getElectricianRegion());
        electricianBean.setPsElectricianName(request.getElectricianName());
        electricianBean.setPsElectricianState(request.getElectricianState());

        try {
            List<ElectricianResp> respList = new ArrayList<>();
            for(ElectricianBean returnBean : service.findAllByCondition(electricianBean)){
                ElectricianResp resp = new ElectricianResp();
                resp.setElectricianCode(returnBean.getPsElectricianCode());
                resp.setElectricianHead(returnBean.getPsElectricianHead());
                resp.setElectricianName(returnBean.getPsElectricianName());
                resp.setElectricianPhone(returnBean.getPsElectricianPhone());
                resp.setElectricianPwd(returnBean.getPsElectricianPwd());
                resp.setElectricianIdFrontImg(returnBean.getPsElectricianIdFrontImg());
                resp.setElectricianIdBackImg(returnBean.getPsElectricianIdBackImg());
                resp.setElectricianIdCode(returnBean.getPsElectricianIdCode());
                resp.setElectricianNvqImg(returnBean.getPsElectricianNvqImg());
                resp.setElectricianProvince(returnBean.getPsElectricianProvince());
                resp.setElectricianCity(returnBean.getPsElectricianCity());
                resp.setElectricianRegion(returnBean.getPsElectricianRegion());
                resp.setElectricianAddress(returnBean.getPsElectricianAddress());
                resp.setElectricianLatitude(returnBean.getPsElectricianLatitude());
                resp.setElectricianLoginState(returnBean.getPsElectricianLoginState());
                resp.setElectricianState(returnBean.getPsElectricianState());
                resp.setElectricianStateRemarks(returnBean.getPsElectricianStateRemarks());
                respList.add(resp);
            }

            Map map = new HashMap();
            map.put("pageInfo", pageInfo);
            map.put("rows", respList);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 电工业务数据统计-工单总数(接单和抢单)、接单数、抢单数、当月接抢单数
     * 服务器访问路径：http://localhost:8080/bolg/electrician/getElectricianStatisticsWorkOrder
     * 本地访问路径：http://localhost:8111/electrician/getElectricianStatisticsWorkOrder
     * 参数：
     * {"electricianCode":"ELE20241218235907"}
     */
    @ApiOperation(value = "电工业务数据统计-工单总数(接单和抢单)、接单数、抢单数、当月接抢单数", notes = "参数：{\"electricianCode\":\"ELE20241218235907\"}", response = ElectricianWorkOrderStatisticsResp.class)
    @RequestMapping(value = "/getElectricianStatisticsWorkOrder",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getElectricianStatisticsWorkOrder(@RequestBody ElectricianRequest request){
        String result;
        try {
            WorkOrderBean workOrderBean = new WorkOrderBean();
            workOrderBean.setPsElectricianCode(request.getElectricianCode());
            workOrderBean.setPsWorkOrderState(-1);
            workOrderBean.setPsFeedbackType(3);

            List<WorkOrderBean> returnAllBeans = workOrderService.findAllByCondition(workOrderBean);

            ElectricianWorkOrderStatisticsResp ewosResp = new ElectricianWorkOrderStatisticsResp();
            int workOrderReceivingNum = 0;
            int workOrderCompetitionNum = 0;
            int workOrderSameMonthCompleteNum = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(WorkOrderBean wob: returnAllBeans){
                    if(wob.getPsWorkOrderType() == 1){
                        workOrderReceivingNum += 1;
                    } else if(wob.getPsWorkOrderType() == 2){
                        workOrderCompetitionNum += 1;
                    }

                    if(!StringUtils.isEmpty(wob.getPsWorkOrderAcceptDate())){
                        if(DateUtil.isThisMonth(DateUtil.strToDate(wob.getPsWorkOrderAcceptDate(),"yyyy-MM")) == true){
                            workOrderSameMonthCompleteNum += 1;
                        }
                    }
                }
                ewosResp.setWorkOrderTotalNum(returnAllBeans.size());
                ewosResp.setWorkOrderReceivingNum(workOrderReceivingNum);
                ewosResp.setWorkOrderCompetitionNum(workOrderCompetitionNum);
                ewosResp.setWorkOrderSameMonthCompleteNum(workOrderSameMonthCompleteNum);
            }else{
                ewosResp.setWorkOrderTotalNum(0);
                ewosResp.setWorkOrderReceivingNum(0);
                ewosResp.setWorkOrderCompetitionNum(0);
                ewosResp.setWorkOrderSameMonthCompleteNum(0);
            }

            Map map = new HashMap();
            map.put("data", ewosResp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 电工业务数据统计-评分分布、平均分数
     * 服务器访问路径：http://localhost:8080/bolg/electrician/getElectricianStatisticsEvaluate
     * 本地访问路径：http://localhost:8111/electrician/getElectricianStatisticsEvaluate
     * 参数：
     * {"electricianCode":"ELE20241218235907"}
     */
    @ApiOperation(value = "电工业务数据统计-评分分布、平均分数", notes = "参数：{\"electricianCode\":\"ELE20241218235907\"}", response = ElectricianEvaluateStatisticsResp.class)
    @RequestMapping(value = "/getElectricianStatisticsEvaluate",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getElectricianStatisticsEvaluate(@RequestBody ElectricianRequest request){
        String result;
        try {
            EvaluateBean evaluateBean = new EvaluateBean();
            evaluateBean.setPsElectricianCode(request.getElectricianCode());

            List<EvaluateBean> returnAllBeans = evaluateService.findAllByElectricianCode(evaluateBean);

            ElectricianEvaluateStatisticsResp eesResp = new ElectricianEvaluateStatisticsResp();
            double averageScoreToCustomer = 0;
            int onePointsNumToCustomer = 0;
            int twoPointsNumToCustomer = 0;
            int threePointsNumToCustomer = 0;
            int fourPointsNumToCustomer = 0;
            int fivePointsNumToCustomer = 0;

            double averageScoreToAdmin = 0;
            int onePointsNumToAdmin = 0;
            int twoPointsNumToAdmin = 0;
            int threePointsNumToAdmin = 0;
            int fourPointsNumToAdmin = 0;
            int fivePointsNumToAdmin = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(EvaluateBean eb: returnAllBeans){
                    averageScoreToCustomer = averageScoreToCustomer += eb.getPsEvaluateCustomerScore();
                    averageScoreToAdmin = averageScoreToAdmin += eb.getPsEvaluateAdminScore();
                    if(eb.getPsEvaluateCustomerScore() == 1){
                        onePointsNumToCustomer += 1;
                    }else if(eb.getPsEvaluateCustomerScore() == 2){
                        twoPointsNumToCustomer += 1;
                    }else if(eb.getPsEvaluateCustomerScore() == 3){
                        threePointsNumToCustomer += 1;
                    }else if(eb.getPsEvaluateCustomerScore() == 4){
                        fourPointsNumToCustomer += 1;
                    }else if(eb.getPsEvaluateCustomerScore() == 5){
                        fivePointsNumToCustomer += 1;
                    }

                    if(eb.getPsEvaluateAdminScore() == 1){
                        onePointsNumToAdmin += 1;
                    }else if(eb.getPsEvaluateAdminScore() == 2){
                        twoPointsNumToAdmin += 1;
                    }else if(eb.getPsEvaluateAdminScore() == 3){
                        threePointsNumToAdmin += 1;
                    }else if(eb.getPsEvaluateAdminScore() == 4){
                        fourPointsNumToAdmin += 1;
                    }else if(eb.getPsEvaluateAdminScore() == 5){
                        fivePointsNumToAdmin += 1;
                    }
                }
                eesResp.setAverageScoreToCustomer(Double.parseDouble(String.format("%.2f", averageScoreToCustomer / returnAllBeans.size())));
                eesResp.setGetOnePointsNumToCustomer(onePointsNumToCustomer);
                eesResp.setGetTwoPointsNumToCustomer(twoPointsNumToCustomer);
                eesResp.setGetThreePointsNumToCustomer(threePointsNumToCustomer);
                eesResp.setGetFourPointsNumToCustomer(fourPointsNumToCustomer);
                eesResp.setGetFivePointsNumToCustomer(fivePointsNumToCustomer);

                eesResp.setAverageScoreToAdmin(Double.parseDouble(String.format("%.2f", averageScoreToAdmin / returnAllBeans.size())));
                eesResp.setGetOnePointsNumToAdmin(onePointsNumToAdmin);
                eesResp.setGetTwoPointsNumToAdmin(twoPointsNumToAdmin);
                eesResp.setGetThreePointsNumToAdmin(threePointsNumToAdmin);
                eesResp.setGetFourPointsNumToAdmin(fourPointsNumToAdmin);
                eesResp.setGetFivePointsNumToAdmin(fivePointsNumToAdmin);
            }else{
                eesResp.setAverageScoreToCustomer(0);
                eesResp.setGetOnePointsNumToCustomer(0);
                eesResp.setGetTwoPointsNumToCustomer(0);
                eesResp.setGetThreePointsNumToCustomer(0);
                eesResp.setGetFourPointsNumToCustomer(0);
                eesResp.setGetFivePointsNumToCustomer(0);

                eesResp.setAverageScoreToAdmin(0);
                eesResp.setGetOnePointsNumToAdmin(0);
                eesResp.setGetTwoPointsNumToAdmin(0);
                eesResp.setGetThreePointsNumToAdmin(0);
                eesResp.setGetFourPointsNumToAdmin(0);
                eesResp.setGetFivePointsNumToAdmin(0);
            }

            Map map = new HashMap();
            map.put("data", eesResp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }
}
